home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Web Developers Guide to Sound & Music
/
Web Developers Guide to Sound and Music.iso
/
mac
/
Cyber Sounds
/
SHARED.DIR
/
00901_Script_Volume PS
next >
Wrap
Text File
|
1996-01-14
|
2KB
|
55 lines
property pSoundLevel, pThumbSprite, pThumbMin, pThumbMax, pScale
on birth me, thumbSprite, thumbMin, thumbMax, initSoundLevel
set pSoundLevel = initSoundLevel
set pThumbMin = thumbMin
set pThumbMax = thumbMax
set pThumbSprite = thumbSprite
set pScale = (pThumbMax - pThumbMin) / 7.0
return me
end
on mMoveThumb me
set theOffset = the locV of sprite pThumbSprite - the mouseV
repeat while the stillDown
set newLoc = the mouseV + theOffset
if newLoc < pThumbMin then set newLoc = pThumbMin
if newLoc > pThumbMax then set newLoc = pThumbMax
set the locV of sprite pThumbSprite = newLoc
go to the frame
end repeat
set the soundLevel = mGetNewLevel(me)
set pSoundLevel = the soundLevel
end
on mInit me
puppetSprite pThumbSprite, 1
mUpdate(me)
end
on mUpdate me
set the locV of sprite pThumbSprite = mGetNewLoc(me)
set the soundLevel = pSoundLevel
end
on mGetNewLoc me
set newLoc = pThumbMin + ((7 - pSoundLevel) * pScale)
if newLoc < pThumbMin then set newLoc = pThumbMin
if newLoc > pThumbMax then set newLoc = pThumbMax
return newLoc
end
on mGetNewLevel me
set newLevel = 7 + ((pThumbMin - the locV of sprite pThumbSprite) / pScale)
if newLevel < 0 then set newLevel = 0
if newLevel > 7 then set newLevel = 7
return newLevel
end
on dump me
put "pThumbSprite:"&&pThumbSprite
put "pThumbMin:"&&pThumbMin
put "pThumbMax:"&&pThumbMax
put "pSoundLevel:"&&pSoundLevel
put "pScale:"&&pScale
end